//
//  PigVarietyView.m
//  PigMarket
//
//  Created by mac on 2019/4/9.
//  Copyright © 2019 felix.pigmarket.oc. All rights reserved.
//

#import "PigVarietyView.h"

@implementation PigVarietyView

#pragma mark - init method
- (instancetype)init
{
    self = [super init];
    if (self) {
        [self initView];
        [self initLayout];
    }
    return self;
}

- (void)initView {
    // 添加子控件
    [self addSubview:self.pigTitle];
    [self addSubview:self.personalRemarkLab];
    [self addSubview:self.numLab];
}

- (void)initLayout {
    // 布局子控件
    [self.pigTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(10);
        make.height.mas_equalTo(24);
    }];
    [self.numLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.pigTitle.mas_centerY);
        make.left.mas_equalTo(self.pigTitle.mas_right).offset(10);
    }];
    [self.personalRemarkLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.pigTitle.mas_bottom).offset(10);
        make.right.mas_equalTo(-10);
        //        make.height.mas_equalTo(20);
        make.bottom.mas_equalTo(-10);
    }];
}

#pragma mark - getter and setter
- (UILabel *)pigTitle {
    if (!_pigTitle) {
        _pigTitle = [[UILabel alloc] init];
        _pigTitle.textColor = [UIColor textBlackColor];
        _pigTitle.font = [UIFont largerFont];
        _pigTitle.text = @"猪猪猪";
    }
    return _pigTitle;
}
- (UILabel *)numLab {
    if (!_numLab) {
        _numLab = [[UILabel alloc] init];
        _numLab.textColor = [UIColor colorWithHexString:@"#F1935F"];
        _numLab.font = [UIFont systemFontOfSize:10];
        _numLab.backgroundColor = [UIColor colorWithHexString:@"#FEF6EE"];
        _numLab.text = @"编号A123445";
    }
    return _numLab;
}
- (UILabel *)personalRemarkLab {
    if (!_personalRemarkLab) {
        _personalRemarkLab = [[UILabel alloc] init];
        _personalRemarkLab.textColor = [UIColor colorWithHexString:@"#999999"];
        _personalRemarkLab.font = [UIFont smallFont];
        _personalRemarkLab.text = @"个性签名:一只特立独行的猪";
    }
    return _personalRemarkLab;
}
@end
